<?php
namespace app\api\controller;

use think\Controller;
use think\Request;

class Category extends Controller
{
    public function getCategoryByParentId(Request $request)
    {
        $parentId = $request->param('id', '0', 'intval');
        if (!$parentId)
        {
            $this->error('ID不合法');
        }
        //通过ID获取二级城市
        $categorys = model('Category')->getNormalCategorysByparentId($parentId);
        if (!$categorys)
        {
            return show(0, 'error');
        }
        return show(1, 'success', $categorys);
    }



}
